import { Element } from '../../../fieldType'
import commonField from '../../../propertyPanel/commonConfig'
export interface DepElement extends Element {
  selectType: number // 选择类型
  optionalScope: { // 可选范围
    dept: string[]
    service: string[]
    technology: string[]
  }
  hint: string
  defaultValueObject: { fixedValue: string }
  width: number
  dataType: number
  defaultType: number
}
function formListFactory () {
  return [
    commonField.name,
    commonField.attrCode,
    { label: '选择类型', name: 'selectType', type: 'radio', data: [{ label: '单选', value: 1 }, { label: '多选', value: 2 }] },
    { label: '范围类型', name: 'dataType', type: 'select', data: [{ label: '部门', value: 2 }, { label: '技能组', value: 4 }, { label: '服务组', value: 5 }] },
    { label: '可选范围', name: 'optionalScope', type: 'slot' },
    { label: '默认值', name: 'defaultValueObject', type: 'slot' },
    commonField.width
  ]
}
const formList = formListFactory()
const formTemplate: DepElement = {
  dataType: 2,
  attrCode: '',
  businessId: '',
  optionalScope: {
    dept: [],
    service: [],
    technology: []
  },
  name: '组织',
  fieldType: 'department',
  selectType: 1,
  hint: '',
  defaultValueObject: { fixedValue: '' },
  defaultType: 1,
  width: 1
}
export default {
  formList,
  formTemplate
}
